package app.srong.configuration;

import app.srong.service.PracticeTopicService;
import app.srong.service.ScheduleLogService;
import app.srong.service.WordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

@Configuration
@EnableScheduling
public class ScheduleConfiguration {
    @Autowired
    WordService wordService;

    @Autowired
    PracticeTopicService practiceTopicService;

    @Autowired
    ScheduleLogService scheduleLogService;

    @Scheduled(cron = "0 30 * * * ?")
    public void clearEmptyPractice() {
        String message = practiceTopicService.clearData();
        System.out.println(message);

        scheduleLogService.save(message,"clearEmptyPractice");

    }

//    @Scheduled(cron = "0/2 * * * * ?")
    public void updateWord(){
        wordService.updateOneWord();
    }
}
